package com.ruoyi.points.pointsAccessDetail.service.impl;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.points.pointsAccessDetail.mapper.PointsAccessDetailMapper;
import com.ruoyi.points.pointsAccessDetail.domain.PointsAccessDetail;
import com.ruoyi.points.pointsAccessDetail.service.IPointsAccessDetailService;

/**
 * 积分详情Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-07
 */
@Service
public class PointsAccessDetailServiceImpl implements IPointsAccessDetailService 
{
    @Autowired
    private PointsAccessDetailMapper pointsAccessDetailMapper;

    /**
     * 查询积分详情
     * 
     * @param id 积分详情主键
     * @return 积分详情
     */
    @Override
    public PointsAccessDetail selectPointsAccessDetailById(Long id)
    {
        return pointsAccessDetailMapper.selectPointsAccessDetailById(id);
    }

    /**
     * 查询积分详情列表
     * 
     * @param pointsAccessDetail 积分详情
     * @return 积分详情
     */
    @Override
    public List<PointsAccessDetail> selectPointsAccessDetailList(PointsAccessDetail pointsAccessDetail)
    {
        List<PointsAccessDetail> list = pointsAccessDetailMapper.selectPointsAccessDetailList(pointsAccessDetail);
        if (pointsAccessDetail.getAccessName() != null) {
            List<PointsAccessDetail> list1 = new ArrayList<>();
            for (PointsAccessDetail i : list) {
                if (i.getAccessName().contains(pointsAccessDetail.getAccessName())) {
                    list1.add(i);
                }
            }
            return list1;
        }
        return list;
    }

    /**
     * 新增积分详情
     * 
     * @param pointsAccessDetail 积分详情
     * @return 结果
     */
    @Override
    public int insertPointsAccessDetail(PointsAccessDetail pointsAccessDetail)
    {
        return pointsAccessDetailMapper.insertPointsAccessDetail(pointsAccessDetail);
    }

    /**
     * 修改积分详情
     * 
     * @param pointsAccessDetail 积分详情
     * @return 结果
     */
    @Override
    public int updatePointsAccessDetail(PointsAccessDetail pointsAccessDetail)
    {
        return pointsAccessDetailMapper.updatePointsAccessDetail(pointsAccessDetail);
    }

    /**
     * 批量删除积分详情
     * 
     * @param ids 需要删除的积分详情主键
     * @return 结果
     */
    @Override
    public int deletePointsAccessDetailByIds(Long[] ids)
    {
        return pointsAccessDetailMapper.deletePointsAccessDetailByIds(ids);
    }

    /**
     * 删除积分详情信息
     * 
     * @param id 积分详情主键
     * @return 结果
     */
    @Override
    public int deletePointsAccessDetailById(Long id)
    {
        return pointsAccessDetailMapper.deletePointsAccessDetailById(id);
    }

    @Override
    public int selectCountById(PointsAccessDetail pointsAccessDetail) {
        return pointsAccessDetailMapper.selectCountById(pointsAccessDetail);
    }
}
